<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>物资更改</title>

    <link rel="stylesheet" href="./css/self.css">
</head>

<body>
    <div class="sidebar">

        <ol class="sidebar-box">
            <li>
                <h1 style="color: aqua;">test</h1>
            </li>
            <li class=""><img src="" alt="" class="siderbar-img"><a href="./index.html" class="sidebar-text">首页</a></li>
            <li class=""><img src="" alt="" class="siderbar-img"><a href="./warehouse-query.html" class="sidebar-text">物资查询</a></li>
            <li class="sidebar-now"><img src="" alt="" class="siderbar-img"><a href="./warehouse-change.html" class="sidebar-text">物资更改</a></li>
            <li class=""><img src="" alt="" class="siderbar-img"><a href="./warehouse-add.html" class="sidebar-text">入库操作</a></li>
            <li class=""><img src="" alt="" class="siderbar-img"><a href="./warehouse-out.html" class="sidebar-text">出库操作</a></li>
            <li class=""><img src="" alt="" class="siderbar-img"><a href="./warehouse-queryadd.html" class="sidebar-text">入库表单查询</a></li>
            <li class=""><img src="" alt="" class="siderbar-img"><a href="./warehouse-queryout.html" class=" sidebar-text ">出库表单查询</a></li>
        </ol>

    </div>
    <div class="head-box">
        <h1>欢迎来到仓库管理系统</h1>
    </div>
    <div class="main-box">
        <h1 style="text-align: center;font-size: 50px;color: cornflowerblue;">你好，超级管理员</h1>
        <div style="height: auto;margin: 50px;border: 1px solid white;background-color: rgba(255, 255, 255, 0.493);">
            <h1>物资更改(更改时某个项目不更改则填*)</h1>
            <div class="message" style="display: flex;align-items: center;">
                <span>
                    <label for="gid_input" class="name_input">商品id*</label>
                    <input type="text" name="gid_input" id="gid_input">
                </span>
                <span>
                    <label for="gname_input" class="name_input">商品名称*</label>
                    <input type="text" name="gname_input" id="gname_input">
                </span>
                <span>
                    <label for="gtype_input" class="name_input">商品种类*</label>
                    <input type="text" name="gtype_input" id="gtype_input">
                </span>
                <span>
                    <label for="gnumber_input" class="name_input">商品数量*</label>
                    <input type="number" name="gnumber_input" id="gnumber_input">
                </span>
                <span>
                    <label for="warehouse_id" class="name_input">仓库名称(store1)*</label>
                    <input type="text" name="warehouse_id" id="warehouse_id">
                </span>
                <span>
                    <label for="gprice_input" class="name_input">单价</label>
                    <input type="text" name="gprice_input" id="gprice_input">
                </span>
                <span>
                    <label for="notes_input" class="name_input">备注</label>
                    <input type="text" name="notes_input" id="notes_input">
                </span>
                <span>
                    <button id="change_btn" onclick="insert_btn_change_onclick()">更改</button>

                </span>
            </div>
            <div id="output">

            </div>
        </div>
</body>
<script type="text/javascript" src="./node_modules/jquery/dist/jquery.js" charset="UTF-8"></script>
<script>
    function insert_btn_change_onclick() {
        var input_gid = document.getElementById('gid_input').value;
        var input_gname = document.getElementById('gname_input').value;
        var input_warehouseid = document.getElementById('warehouse_id').value;
        var input_number = document.getElementById('gnumber_input').value;
        var input_gtype = document.getElementById('gtype_input').value;
        var input_gnote = document.getElementById('notes_input').value;
        var input_gprice = document.getElementById('gprice_input').value;
        url0 = "http://localhost:80/index.php/Mysql/mysql_insert_change_bygid/input_table_name/" + input_warehouseid + "/input_gid/" + input_gid + "/input_gname/" + input_gname + "/input_gtype/" + input_gtype + "/input_gnumber/" + input_number + "/input_gprice/" + input_gprice + "/input_gnote/" + input_gnote
        console.log(url0);
        $.ajax({
            url: url0,
            async: pageYOffset,
            contentType: "application/x-www-form-urlencoded",
            dataType: "json",
            success: function(data) {
                console.log(data);
                data_np = Object.values(data);
                var output = document.getElementById('output');
                var value_np_out = "";
                value_np_out += "<table id='output_table'>" + "<thead>" + "<tr>" + "<th>ID</th><th>商品名称</th><th>商品种类</th><th>商品数量</th><th>商品单价</th><th>商品备注</th>" + "</tr>" + "</thead>" + "<tbody><tr>"
                for (i1 = 0; i1 < data_np.length; i1++) {
                    value_np_out += "<td>" + data_np[i1] + "</td>";
                }
                value_np_out += "</tr></tbody><table>"
                console.log(value_np_out);
                output.innerHTML = value_np_out;
            },
            error: function(err) {
                // 请求失败， err是失败的内容
                print("请求失败");
            },
            complete: function(e) {
                // 不管成功还是失败都会调用这个函数
            }
        })
    }
</script>


</html>